{template 'header',$module}
{if $MG[memtype] >= 5 && !$_edittime}
<div class="warn">您尚未完善详细资料！完善的商业信息有助于获得别人的信任，结交潜在的商业伙伴，获取商业机会，请尽快完善</div>
{/if}
{if isset($success)}
<div class="ui-widget ui-xd-warning">
	<div class="ui-state-highlight ui-corner-all">
		<p>
			<span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 1em;"></span>资料保存成功
			您可以：
			<a href="{url('member/edit')}" class="t">继续完善</a> |
			<a href="{url('member/my')}" class="t">发布信息</a> |
			<a href="{url('member/index')}" class="t">返回管理</a>
		</p>
	</div>
</div>
{/if}
<div class="main-block bd-gray mt10">
    <div class="hd fn-clear">
        <h2 class="fn-left">修改资料</h2>
    </div>
    <form method="post" class="form" action="edit.php" id="pub-form">
    <input type="hidden" name="tab" id="tab" value="{$tab}"/>
    <div id="memberTab" class="easyui-tabs con mt10 fn-clear">
	    <div id="tab_contact" class='root' title="我的资料">
		    <table class="data-form c666 mt10">
			    <tr>
				    <th width="90">会员名：</th>
				    <td><b>{$_username}</b></td>
			    </tr>
			    {if $vtruename}
			    <tr>
				    <th><span class="cred">*</span>我的姓名：</th>
				    <td><input type="hidden" name="post[truename]" id="truename" value="{$truename}" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写真实姓名'"/>{$truename}&nbsp;&nbsp;<img src="image/v_truename.gif" title="已认证" align="absmiddle"/></td>
			    </tr>
			    {else}
			    <tr>
				    <th><span class="cred">*</span>我的姓名：</th>
				    <td><input type="text" size="10" name="post[truename]" id="truename" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[1,50]',missingMessage:'请填写真实姓名'"  value="{$truename}"/>
					    <span >(可填写姓名、英文名、姓氏+职位、姓氏+先生女士等等)</span></td>
			    </tr>
			    {/if}
			    <tr>
				    <th><span class="cred">*</span>性别：</th>
				    <td>
					    <input class="fn-left mr5 nobd" id="male" type="radio" name="post[gender]" value="1" {if $gender==1}checked="checked"{/if}/>
                        <label for="male" class="fn-left mr10">先生</label>
					    <input class="fn-left mr5 nobd" id="female" type="radio" name="post[gender]" value="2" {if $gender==2}checked="checked"{/if}/>
                        <label for="female" class="fn-left mr10">女士</label>
				    </td>
			    </tr>
			    {if $_groupid < 6}
			    <tr>
				    <th><span class="cred">*</span>所在地区：</th>
				    <td>{Post::areaCombo('post[areaid]', $areaid )}&nbsp;<span id="dareaid" class="cred"></span></td>
			    </tr>
			    <tr>
				    <th>联系地址：</th>
				    <td><input type="text" size="40" name="post[address]" id="daddress" value="{$address}"/>&nbsp;<span id="ddaddress" class="cred"></span></td>
			    </tr>
			    <tr>
				    <th>邮政编码：</th>
				    <td><input type="text" size="8" name="post[postcode]" id="postalcode" value="{$postcode}"/></td>
			    </tr>
			    <tr>
				    <th>联系电话：</th>
				    <td><input type="text" size="20" name="post[telephone]" id="telephone" value="{$telephone}"/>&nbsp;<span id="dtelephone" class="cred"></span></td>
			    </tr>
			    {/if}
			    {if $vmobile}
			    <tr>
				    <th>手机号码：</th>
				    <td><input type="hidden" name="post[mobile]" id="mobile" value="{$mobile}"/>{$mobile}&nbsp;&nbsp;<img src="image/v_mobile.gif" title="已认证" align="absmiddle"/>&nbsp;&nbsp;<a href="send.php?action=mobile" class="t">[修改]</a></td>
			    </tr>
			    {else}
			    <tr>
				    <th >手机号码：</th>
				    <td><input type="text" size="20" name="post[mobile]" id="mobile" value="{$mobile}"/></td>
			    </tr>
			    {/if}
			    <tr>
				    <th>Email：</th>
				    <td>{$_email}{if $vemail}&nbsp;&nbsp;<img src="image/v_email.gif" title="已认证" align="absmiddle"/>{/if}&nbsp;&nbsp;<a href="send.php?action=email" class="t">[修改]</a></td>
			    </tr>
			    {if $DT[im_qq]}
			    <tr>
				    <th>QQ：</th>
				    <td><input type="text" size="20" name="post[qq]" id="qq" value="{$qq}"/></td>
			    </tr>
			    {/if}
			    {if $DT[im_ali]}
			    <tr>
				    <th>阿里旺旺：</th>
				    <td><input type="text" size="20" name="post[ali]" id="ali" value="{$ali}"/></td>
			    </tr>
			    {/if}
			    {if $DT[im_msn]}
			    <tr>
				    <th>MSN：</th>
				    <td><input type="text" size="30" name="post[msn]" id="msn" value="{$msn}"/></td>
			    </tr>
			    {/if}
			    {if $DT[im_skype]}
			    <tr>
				    <th>Skype：</th>
				    <td><input type="text" size="20" name="post[skype]" id="skype" value="{$skype}"/></td>
			    </tr>
			    {/if}
			</table>
	    </div>
	    {if $MG['memtype'] >= 5}
	    <div id="tab_company" class='root' title="企业资料">
		    <table class="data-form c666 mt10">
			    <tr>
				    <th width="90">企业名称：</th>
				    <td class="tr f_b"><input type="text" name="post[company]" size='45' class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[2,50]',invalidMessage:'长度在2-50内',missingMessage:'请填写企业名称'" value="{$company}"></td>
			    </tr>
			    <tr>
				    <th width="90"><span class="cred">*</span>所在地区：</th>
				    <td class="tr">{Post::areaCombo('post[areaid]', $areaid)}</td>
			    </tr>
			    <tr>
				    <th width="90"><span class="cred">*</span>主营行业：</th>
				    <td>
                        <input id="chooseCat" type="button" value="选择/修改"/>请选择主营行业。
				    </td>
			    </tr>
                <tr>
                    <th width="90">已选行业：</th>
                    <td>
                        <ul id="selectedCats" class="fn-clear" name="select">
	                        {loop $cates $t}
	                        {if $t}
	                        <li id="{$t}" class="fn-left fn-clear mr5">
		                        <span class="fn-left">{get_cache_category_name(4,$t)}</span>
		                        <a href="javascript:void(0);" title="删除此项" class="del fn-left"></a>
	                        </li>
	                        {/if}
	                        {/loop}
                        </ul>
                        <select name="post[catid][]" multiple="multiple" id="cates" size="2" style="display: none;">
	                        {loop $cates $t}
	                        <option id="{$t}" value="{$t}" selected="selected">{get_cache_category_name(4,$t)}</option>
	                        {/loop}
                        </select>
                    </td>
                </tr>
			    <tr>
				    <th width="90"><span class="cred">*</span>企业成立年份：</th>
				    <td class="tr"><input type="text" size="15" name="post[regyear]"  class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[2,50]',invalidMessage:'长度在2-50内',missingMessage:'请填写企业成立年份'"  value="{$regyear}" maxlength="4"/>&nbsp;<span id="dregyear"
				                                                                                                                                                                                                                                                                      class="cred"></span> <span class="f_gray">(年份，如：2004)</span></td>
			    </tr>
			    <tr>
				    <th width="90">企业规模：</th>
				    <td class="tr">{dselect($COM_SIZE, 'post[size]', '请选择规模', $size, '', 0)}</td>
			    </tr>
			    <tr>
				    <th width="90">注册资本：</th>
				    <td class="tr">{dselect($MONEY_UNIT, 'post[regunit]', '', $regunit, '', 0)} <input type="text" size="6" name="post[capital]" id="capital" value="{$capital}"/> 万</td>
			    </tr>
			    <tr>
				    <th width="90"><span class="cred">*</span>企业地址：</th>
				    <td class="tr"><input type="text" size="60" name="post[address]" class="graybd-ipt easyui-validatebox" data-options="required:true,validType:'length[2,50]',invalidMessage:'长度在2-50内',missingMessage:'请填写企业地址'" value="{$address}" maxlength="200"/>&nbsp;<span id="ddaddress"
				                                                                                                                                                                                                                                                                    class="cred"></span></td>
			    </tr>
			    <tr>
				    <th width="90">邮政编码：</th>
				    <td class="tr"><input type="text" size="8" name="post[postcode]" id="postalcode" value="{$postcode}"/></td>
			    </tr>
			    <tr>
				    <th width="90"><span class="cred">*</span>企业电话：</th>
				    <td class="tr"><input type="text" size="20" name="post[telephone]" class="graybd-ipt easyui-validatebox" data-options="required:true,missingMessage:'请填写企业电话'"  value="{$telephone}"/>&nbsp;<span id="dtelephone" class="cred"></span></td>
			    </tr>
			    <tr>
				    <th width="90">企业传真：</th>
				    <td class="tr"><input type="text" size="20" name="post[fax]" id="fax" value="{$fax}"/></td>
			    </tr>
			    <tr>
				    <th width="90">Email：</th>
				    <td class="tr"><input type="text" size="30" name="post[mail]" id="mail" value="{$mail}"/> <span class="f_gray">[公开]</span></td>
			    </tr>
			    <tr>
				    <th width="90">企业网址</th>
				    <td class="tr"><input type="text" size="30" name="post[homepage]" id="homepage" value="{$homepage}"/></td>
			    </tr>

		    </table>
		    <!--主营行业 对话框 start-->
		    <div style="display: none">
			    <div id="companyCat" title="选择分类" class="easyui-dialog"  style="padding:10px;" data-options="closed:'true'">
				    <div class="company-cat">
					    {Ext::categoryHtml($cartree)}
				    </div>
			    </div>
		    </div>
		    <!--主营行业 对话框 end-->
		    <script>
			    seajs.use(['mod-catSelection'],function(CatSel){
                    var catSel = new CatSel('chooseCat','companyCat','selectedCats','cates');
                    catSel.run();
			    });
		    </script>
	    </div>
	    <div  class='root' title='<span id="join_company" >加入企业库</span>'></div>
	    {/if}
	    <div id="tab_changePass" class='root' title="修改密码">
		    <table class="data-form c666 mt10">
			    <tr>
				    <th width="90">新登录密码</th>
				    <td class="tr"><input type="password" size="20" name="post[password]" id="password" onblur="validator('password');"/>&nbsp;<span class="f_gray">如不更改密码,请留空</span> <span id="dpassword" class="cred"></span></td>
			    </tr>
			    <tr>
				    <th width="90">重复新密码</th>
				    <td class="tr"><input type="password" size="20" name="post[cpassword]" id="cpassword"/>&nbsp;<span id="dcpassword" class="cred"></span></td>
			    </tr>
			    <tr>
				    <th width="90">现有密码</th>
				    <td class="tr cred"><input type="password" size="20" name="post[oldpassword]" id="oldpassword"/>&nbsp; 如要更改密码，需输入现有密码 <span id="doldpassword" class="cred"></span></td>
			    </tr>
			</table>
	    </div>
    </div>

    <div class="con pl105 fn-clear">
	    <button type="submit" class="fn-left mr20 btn">保 存</button>
	    <button type="button" class="btn" onclick="history.back(-1);">返回</button>
    </div>
    </form>
 </div>
<script>
	seajs.use(['member','easyui','easyui-css'], function(member){
		var $memberTab = $('#memberTab');
		$memberTab.tabs();//tab切换
			$('#join_company').parents('.tabs-inner').click(function(){
				window.open("{SITE_URL}company/create.php?title={$_company}");
				return false;
			});
        //表单验证
        function validField(){
            $('#pub-form input,#pub-form select,#pub-form textarea').each(function(){
                if (!(typeof($(this).attr("data-options"))=="undefined") || $(this).hasClass('validatebox-text')) {
                    if (!$(this).validatebox('isValid')) {//判断当前域是否合法
                        var tabIndex =$(this).parents("div.panel").index();//获取tab内容索引
                        var tabTitle = $("ul.tabs>li").eq(tabIndex).find('.tabs-title').text();//获取tab标题
	                    $memberTab.tabs('select',tabTitle);//定位对应tab
                        return $('#pub-form').form('validate');
                    }
                }
            });
        }
		$('#pub-form').on('submit', function(){
			{if $_groupid > 5}
            var curSelTab = $('#memberTab').tabs('getSelected'),
                curTabIndex = $('#memberTab').tabs('getTabIndex',curSelTab);
            if(curTabIndex == 1){
                var count = $('#cates').find('option').length;
                if( count == 0){
                    $.messager.alert('提示','请选择公司主营行业！')
                    return false;
                }
            }
			{/if}
            validField();
			return $('#pub-form').form('validate');
		});
		<!--{if $tabStr}-->
		$(function(){
			$memberTab.tabs('select', '{$tabStr}');
			<!--{if $tab!=5}-->
			member.active('menu_general', 'edit_{$tab}', 'status_{if $status}{$status}{else}3{/if}')
			<!--{/if}-->
		});
		<!--{/if}-->
	})
</script>
{template 'footer', 'member'}